home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
007
/
profile.arc
/
PROFILE.DOC
< prev
next >
Wrap
Text File
|
1985-11-28
|
7KB
|
198 lines
PROFILE (1) Program Execution Profiler PROFILE (1)
NAME NAME
profile - program profiler
SYNOPSIS SYNOPSIS
profile program progarg1 progarg2 progargn profile program progarg1 progarg2 .. progargn
DESCRIPTION DESCRIPTION
profile profile is used to determine where a program spends most of
its time executing, in order to determine where in that
program it will be profitable to optimize. When invoked, it
program progarg1 progarg2 will run program ,passing along progarg1 progarg2 ..
progargn program s progargn as program's command line. After the program
being profiled terminates, a list of addresses is printed to
the standard output, along with the number of times the
program profiler interrupted program at that address.
SH EXAMPLE
profile tester.exe
cs=607c
003c : 40
0040 : 141
0044 : 12
0048 : 5
004c : 1
0050 : 8
0054 : 3
0058 : 7
0060 : 10
0064 : 5
0068 : 8
0710 : 1
tester exe What happened here is that tester.exe was executed, and that
profile profile was of the opionion that it spent most of its time
right around cs:0040.
IMPLEMENTATION IMPLEMENTATION
Profile Profile is only able to interrupt the program being profiled
18.2 times per second. That means that in order to get
meaningful results, your program must take longer than a few
seconds to execute, and that it not be I/O bound. That,
fortunately, is a fairly good definition of the sort of
programs that need profiling.
cs 607c You may have noticed that in the above example that cs=607c
was printed out before the profile information. That
regs exe message was actually printed by the program regs.exe, that
profile com was invoked by profile.com to determine where MSDOS was
Regs exe going to load tester.exe. Regs.exe figures out where its
loaded, and writes this out to a temporary file called
register profile com register, which profile.com then reads in. This process is
necessary because there is no other way to determine wher
MS-DOS is going to load a program.
-1-
PROFILE (1) Program Execution Profiler PROFILE (1)
Even stranger, it is necessary to also have the program
regs com com regs.com available if you want to profile a '.com' program,
com as MS-DOS puts '.com' programs in a different place than
exe '.exe' programs.
This program was compiled with the Manx Aztec C86 compiler.
I have put in conditional assembly flags to ease using
Lattice, but there is one difference that will have to be
fexecv dealt with. The Aztec fexecv library function expects the
exe com .exe|.com extension in its specified file name, where
forkv Lattice's forkv does not. So, you will have to use a
different method than I did to determine whether a program
com exe is an .com or a .exe program. I might suggest opening the
exe file and looking for the .exe 'magic number' bytes at the
beginning of the file (4DH and 5A). This will unfortunately
slow things down a bit more, but that's life in PC-DOS.
The assembly source files might need some massaging to
coincide with the way Lattice wants the segments defined in
assembly subroutines. I didn't bother to put in conditional
assembly directive to accomadate Lattice, because the
conversion process should be straightforward, and a good
excersise for 'porting hackers.'
If anyone out there cares, the Manx Aztec C86 compiler
(version 3 and later) makes the Lattice compiler look pretty
limp, and is a lot more straightforward to work with.
Documentation and supporting tools are excellent, and
performance is unparalleled. It lives up to the claims in
their somewhat incoherent ads, and I'd recommend it to
anyone doing serious work with C.
ENHANCEMENTS ENHANCEMENTS
A more graphic way of displaying profiler results would be
nice, but a more useful enhancement would be to merge
profile s profile's output with the symbol table output of your
compiler of choice.
-2-